/*** Trigger Name: ifulfillRestrictEditWDefinition 
 * Author: Accenture
 * Date: 10-feb-2012
 * Requirement/Project Name: iFulfill
 * Requirement Description: 
 **/

trigger ifulfillRestrictEditWDefinition on Workflow_Definition__c (before update) 
{
    for(Workflow_Definition__c wfdObj: trigger.new) 
    {
          // Check if workflow is in pending inactive or inactive status   
          if( trigger.newMap.get(wfdObj.id).status__c == trigger.oldMap.get(wfdObj.id).status__c && (wfdObj.status__c == IfullfillTextConstant.WF_DEF_PENDING_IN_ACTIVATION_STATUS ||wfdObj.status__c == IfullfillTextConstant.WF_DEF_INACTIVE_STATUS))
              wfdObj.adderror('Cannot edit the Workflow which  is in Pending Inactive or Inactive status.');
    } 
}